package com.leadnews.controller;

import com.leadnews.pojo.User;
import com.leadnews.service.UserService;
import com.leadnews.vo.PageResultVo;
import com.leadnews.vo.PageVo;
import com.leadnews.vo.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

@RestController
@RequestMapping
@CrossOrigin(origins = "*",maxAge = 3600)
public class UserController {
    @Autowired
    UserService userService;
    @PostMapping("/user/getUserList")
    public PageResultVo  getUserList(@RequestBody PageVo pageVo){
        return userService.getUserList(pageVo);
    }

    @PostMapping("/user/addconfirm")
    public ResponseResult adduser(@RequestBody User user){
        return userService.adduser(user);
    }

    @PostMapping("/user/deleteAll")
    public ResponseResult deleteAll(@RequestBody List<String> list, HttpServletRequest httpServletRequest){
        return userService.deleteAll(list,httpServletRequest);
    }

}
